package com.kuang.demo.vo.wx;

import lombok.Data;

import java.util.List;

@Data
public class Order4ListVo {

    private String orderStatusText;
    private boolean isGroupin = false;
    private String orderSn;
    private double actualPrice;
    private int id;
    private HandleOptionBean handleOption = new HandleOptionBean();
    private List<Goods4OrderListVo> goodsList;

    public void setOrderStatusText(String orderStatusText) {
        int status = Integer.parseInt(orderStatusText);
        if (status == 101) {
            this.orderStatusText = "未付款";
            handleOption.setPay(true);
            handleOption.setCancel(true);
            handleOption.setDelete(true);
        } else if (status == 102) {
            this.orderStatusText = "用户取消";
            handleOption.setRebuy(true);
            handleOption.setDelete(true);
        } else if (status == 103) {
            this.orderStatusText = "系统取消";
            handleOption.setDelete(true);
            handleOption.setRebuy(true);
        } else if (status == 201) {
            this.orderStatusText = "已付款";
            handleOption.setRefund(true);
        } else if (status == 202) {
            this.orderStatusText = "申请退款";
            handleOption.setRebuy(true);
        } else if (status == 203) {
            this.orderStatusText = "已退款";
            handleOption.setDelete(true);
            handleOption.setRebuy(true);
        } else if (status == 301) {
            this.orderStatusText = "已发货";
            handleOption.setRefund(true);
            handleOption.setConfirm(true);
        } else if (status == 401) {
            this.orderStatusText = "用户收货";
            handleOption.setDelete(true);
        } else if (status == 402) {
            this.orderStatusText = "系统收货";
            handleOption.setDelete(true);
        }
    }

    @Data
    public static class HandleOptionBean {
        private boolean cancel = false;
        private boolean delete = false;
        private boolean pay = false;
        private boolean comment = false;
        private boolean confirm = false;
        private boolean refund = false;
        private boolean rebuy = false;
    }

}
